<%@ page import="java.sql.*" %>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<html>
  <head>
    
    <title>处理合同添加数据</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
<body>
    <% 
        String clientName=new String(request.getParameter("clientName")
            .getBytes("ISO-8859-1"),"UTF-8");
        String contactName=new String(request.getParameter("contactName")
            .getBytes("ISO-8859-1"),"UTF-8");
        String contactContents=new String(request.getParameter("contactContents")
            .getBytes("ISO-8859-1"),"UTF-8");
        String contactStart=new String(request.getParameter("contactStart")
            .getBytes("ISO-8859-1"),"UTF-8");
        String contactEnd=new String(request.getParameter("contactEnd")
            .getBytes("ISO-8859-1"),"UTF-8");
        String StaffName=new String(request.getParameter("StaffName")
            .getBytes("ISO-8859-1"),"UTF-8");
        Connection con=null;
        Statement stmt=null;
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
            con=DriverManager.getConnection(url,"root","123456");
            stmt=con.createStatement();
            String sql="insert into contact(clientName,contactName,contactContents,contactStart,contactEnd,StaffName) values('"
                +clientName+"','"+contactName+"','"+contactContents+"','"+contactStart+"','"
                +contactEnd+"','"+StaffName+"')";
            stmt.executeUpdate(sql);
            response.sendRedirect("../contactManage/lookContact.jsp");
        }
        catch(Exception e){
            e.printStackTrace();
        }
        finally{
            stmt.close();
            con.close();
        }
        
    %>
</body>
</html>